FROM alpine:latest

# 设置中国镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

# 安装必要的工具和 gcompat
RUN apk update && \
    apk add --no-cache \
    ffmpeg \
    wget \
    jq \
    unzip \
    gcompat \
    libstdc++ \
    libintl \
    icu-libs \
    aria2 \
    && rm -rf /var/cache/apk/*

# 设置工作目录
WORKDIR /app

# 下载最新版本的BBDown
RUN wget -q  https://ghproxy.net/https://github.com/nilaoda/BBDown/releases/download/1.6.3/BBDown_1.6.3_20240814_linux-x64.zip && \
    unzip BBDown_1.6.3_20240814_linux-x64.zip && \
    rm BBDown_1.6.3_20240814_linux-x64.zip && \
    chmod +x BBDown && \
    mv BBDown /usr/local/bin/

# 设置容器启动命令
ENTRYPOINT ["BBDown", "serve", "-l", "http://0.0.0.0:12450"]

# 暴露端口
EXPOSE 12450